
<template>
  <div>
    <el-dialog
      v-model="conf.aan_visible"
      title="删除"
      width="30%"
      draggable
      :before-close="hide_aan"
    >
      <span
        >确认删除( 角色名称:<span
          v-text="form_aan.name"
        ></span
        >) 吗?</span
      >
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aan">取消</el-button>
          <el-button type="primary" @click="save_aan">提交</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data(){
    return{
      conf:{
        aan_visible:false,
      },
  //删除 form by  [D]
      form_aan:{name:"",
         },
    }
  },
  methods:{//--------------------删除---------------------------------
      //显示 删除 弹出框
      show_aan(fm){
         Object.assign(this.form_aan,fm)
         this.conf.aan_visible = true;
      },
      //隐藏 删除 弹出框
      hide_aan(){
        this.conf.aan_visible = false;
        this.$refs.fm_aan.resetFields();
      },
      //保存 删除 弹出框数据
      save_aan(){
        let that = this
        this.$theia.http.del("/roleinfo",this.form_aan).then(res=>{
          that.conf.confirmVisible = false 
          that.$notify.success({title: '成功',message: '删除成功',duration:5000})
          that.$emit("onsaved")
          that.hide_aan()
       }).catch(err=>{
          that.conf.confirmVisible = false
          let code = res.response.status
          let msg= `删除失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
       })
    },
    //-----------------------------------------------------------
  },
  
}
</script>